package com.heima.comment.controller.v1;


import com.heima.comment.service.CommentRepayService;
import com.heima.model.comment.dtos.RepayDto;
import com.heima.model.comment.dtos.RepayLikeDto;
import com.heima.model.comment.dtos.RepaySaveDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment_repay/")
public class CommentRepayController {

    @Autowired
    private CommentRepayService commentRepayService;

    /**
     * 保存回复
     *
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody RepaySaveDto dto) {

        return commentRepayService.save(dto);
    }


    /**
     * 查询回复列表
     *
     * @param dto
     * @return
     */
    @PostMapping("/load")
    public ResponseResult load(@RequestBody RepayDto dto) {

        return commentRepayService.load(dto);
    }


    /**
     * 回复点赞
     *
     * @param dto
     * @return
     */
    @PostMapping("/like")
    public ResponseResult like(@RequestBody RepayLikeDto dto) {

        return commentRepayService.like(dto);
    }
}
